package com.app.util;

import java.util.Properties;

import org.apache.log4j.Logger;
/**
 * 
 * @author Murilo Dourado
 *
 */
public class PropertiesHelper {

	private static final Logger log = Logger.getLogger(PropertiesHelper.class);
	
	/**
	 * This method is responsible to return the environment properties 
	 * @param key
	 * @return {@link String}
	 */
	public String getEnvProperties(String key)
	{
		String result = getConfiguration("environmente.properties", key);
		return result;
	}
	/**
	 * This method is responsible to return the content at properties file
	 * @param file
	 * @param key
	 * @return {@link String}
	 */
	private String getConfiguration(String file, String key)
	{
		String result = "";
		Properties p  = new Properties();
	
		try 
		{
			p.load(PropertiesHelper.class.getClassLoader().getResourceAsStream(file));
			result = p.getProperty(key);
		} 
		catch (Exception ex)
		{
			log.error("error to get the properties: ", ex);
			ex.printStackTrace();
		}
		return result;
		
	}
	
	
}
